SRCS	:= $(wildcard *.cpp)

CC		= g++
INCPATH	= ../include
CCFLAG	= -I $(INCPATH) -c -g -O3 -static

UTILS_OBJS = UTIL.o SYSCALL.o GLOBAL.o MemoryManager.o

ENGINE_OBJS = VInst.o VBlockBuilder.o VBasicBlockBuilder.o TBlock.o TCache.o TraceManager.o ExecutionEngine.o RBThread.o

TCACHE_OBJS = SimpleTCache.o

MEMORY_IMAGE_OBJS = ELFMemoryImage.o

REG_ALLOCATOR_OBJS = NextUseRegAllocator.o SimpleRegAllocator.o GlobalRegAllocator.o GraphRegAllocator.o 

PROFILER_OBJS = Profiler.o

LIBCROSSBIT_OBJS = $(UTILS_OBJS) $(ENGINE_OBJS) $(TCACHE_OBJS) $(MEMORY_IMAGE_OBJS) $(REG_ALLOCATOR_OBJS) $(PROFILER_OBJS)

all: $(LIBCROSSBIT_OBJS)
	ar -r libcrossbit.a *.o
	echo "done!"

$(LIBCROSSBIT_OBJS):%.o:%.cpp
	$(CC) $(CCFLAG) $? -o $@

clean:
	rm -rf *.o
	rm *.a
